<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../org/jquery.min.js"></script>
    <script src="../org/angular.min.js"></script>
    <script src="../org/angular-ui-router.min.js"></script>
</head>

<body>
    <div ng-app='vm'>
        <div ui-view></div>
    </div>
    <script>
        angular.module('vm', ['ui.router'])
            .config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
                //config 配置默认路由
                $urlRouterProvider.otherwise('');

                //定义路由规则
                $stateProvider.state('home', {
                    url: '/home',
                    templateUrl: 'view/home.html'
                })
                    .state('home.news', {
                        url: '/news',
                        template: '<h1>新闻</h1>'
                    })
                    .state('login', {
                        url: '/login',
                        template: '<h1>登陆</h1>'
                    })
                    .state('game', {
                        url: 'game',
                        template: '<h1>游戏</h1>'
                    })

            }])
    </script>
</body>

</html>